import os
import pytest

from interface.CartInterface import CartInterface
from interface.MemberInterface import MemberInterface
from interface.OrderInterface import OrderInterface

data = {"username": "Anna", "password": "anna123"}


#  在fixture中,fixturee之间可以相互引用
# 在低级别的fixture可以引用高级别的fixture 高级别的fixture不能引用低级别的fixture
@pytest.fixture(scope="session")
def headers(url):
    return MemberInterface(url).get_member_token(data["username"], data["password"])


@pytest.fixture(scope="session")
def url(url="http://47.108.206.100:8085"):
    return url


@pytest.fixture()
def cart(headers, url):
    return CartInterface(url, headers)


@pytest.fixture()
def order(url, headers):
    return OrderInterface(url, headers)
